using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Spire.Presentation.Demo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnRun_Click(object sender, EventArgs e)
        {
            //create PPT document
            Presentation presentation = new Presentation();

            //set background Image
            string ImageFile = @"..\..\..\..\..\..\Data\bg.png";
            RectangleF rect = new RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height);
            presentation.Slides[0].Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect);
            presentation.Slides[0].Shapes[0].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;

            //append new shape
            IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle,
                new RectangleF(50, 70, 400, 50));

            //set the LineColor
            shape.ShapeStyle.LineColor.Color = Color.Black;

            //set the color and fill style
            shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
            shape.Fill.SolidColor.Color = Color.LightGray;
            shape.AppendTextFrame("This is a demo of text font and color.");

            //set the color of text
            TextRange textRange = shape.TextFrame.TextRange;
            textRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
            textRange.Fill.SolidColor.Color = Color.Green;
            
            //set the Font of text
            textRange.FontHeight = 21;
            textRange.IsItalic = TriState.True;
            textRange.TextUnderlineType = TextUnderlineType.Single;
            textRange.LatinFont = new TextFont("Gulim");

            //save the document
            presentation.SaveToFile("text.pptx", FileFormat.Pptx2007);
            System.Diagnostics.Process.Start("text.pptx");

        }
    }
}